﻿@model IEnumerable<Home.Domain.Entities.PArticle>
@{
    ViewBag.Title = "插件";
    Layout = "~/Areas/ChmNote/Views/Shared/_Layout.cshtml";
}
@section scripts{
    <script type="text/javascript">
        $(function () {
            @*编辑按钮显示隐藏*@
            $(".unstyled>li").mouseover(function () {
                $(this).children().last().show();
            }).mouseout(function () {
                $(this).children().last().hide();
            });
        });
        function loadedit(id) {
            $.get("@Url.Action("EditPArticle")/" + id+"?now=" + new Date().getTime(), {}, function (data) {
                $("#loadedit").html(data);
            }, "text");
        }
    </script>
}
<script type="text/javascript">
    function add() {
        $.post("@Url.Action("AddPArticle")", { Title: $("#title").val(), Navbar: 5 },
            function (data)
        {
                if (data==1) {
                    window.location = "@Url.Action("ChaJian")";
                }
        }, "text");
    }
</script>
<div class="container">

    <!-- Docs nav
    ================================================== -->
    <div class="row">
      <div class="span3 bs-docs-sidebar">
        <ul class="nav nav-list bs-docs-sidenav affix">
          <li><a href="#about-us"><i class="icon-chevron-right"></i>百度编辑器</a></li>
          <li><a href="#show"><i class="icon-chevron-right"></i>展示你的Bootstrap作品</a></li>
          <li><a href="#friends"><i class="icon-chevron-right"></i>Bootstrap中文网的朋友们</a></li>
          <li><a href="#cooperation"><i class="icon-chevron-right"></i> 合作</a></li>
        </ul>
      </div>
      <div class="span9" style="padding-top:30px;">
        
            <ul class="unstyled">
                @foreach (var item in Model)
                {
                    <li><a href="@Url.Action("ArticleList", new {id=item.Id })">@item.Title</a> <button onclick="loadedit(@item.Id)" class="btn btn-mini hide">编辑</button></li>
                }
            </ul>
          @*添加*@
          <div class="modal hide " id="myModal">
  <div class="modal-header">
    <a class="close" data-dismiss="modal">×</a>
    <h3>添加插件标题</h3>
  </div>
              <form action="/" id="pArticle" method="post">
  <div class="modal-body">
   <input type="text" name="title" id="title" />
  </div>
              </form>
  <div class="modal-footer">
    <a href="#" class="btn" data-dismiss="modal">关闭</a>
    <a href="#" onclick="add()" class="btn btn-primary">确定</a>
  </div>
</div>
          <div id="loadedit"></div>
      <a data-toggle="modal" href="#myModal" data-backdrop="false" class="btn">添加</a>
      </div>
      
    </div>

  </div>
